{% extends "homepage.html" %}

{% block content %}

 <script src="{{ url_for('static', filename='jquery.column.min.js')}}"
 type="text/javascript" charset="utf-8"></script>

 <script src="{{ url_for('mwf.static', filename='maass_scripts.js')}}" type="text/javascript" charset="utf-8"></script>

 <script type="text/javascript" charset="utf-8">
 $(document).ready(function() {

jQuery('table:has(col)').each(alignColumns);
var oTable = $("table#coeffs").dataTable(
{
    "sPaginationType": "full_numbers",
    "aoColumns":{{  coeff_aoColumns |safe }},
    "bSort":true,
    "iDisplayLength": 20,    
    "iDisplayStart": 0,
    "oLanguage": {
            "sZeroRecords": "There are no coefficients that match your search criterion",
            "sLengthMenu": "Display _MENU_ coefficients per page",
            "sInfo": "Displaying _START_ to _END_ of _TOTAL_ coefficients",
            "sInfoEmpty": "Showing 0 to 0 of 0 records",
            "sInfoFiltered": "(filtered from _MAX_ total coefficients)"
     }, 
     "sDom": 't<"paging"ip><"bottom"lfr><"filterbox">',
//     "sDom": 't<"paging"p><"bottom"l><"bottom"fr><"filterbox"i>',
     "sScorollX": "300px", 
    "aLengthMenu": [[15, 25, 50, 100, 200, -1], [15, 25, 50, 100,  200, "All"]],
     "bStateSave": false,
     "bAutoWidth": false,
     "oSearch": { "sSearch": "", "bRegex": false, "bSmart": true },

 });

$('.bottom').css("width","100%")
$('.bottom').css("text-align","left")
$('.paging_full_numbers').css('width','250px')
$('#coeffs').css('width','650px')
});
</script>
 
<style type="text/css">
 .dataTables_wrapper { width: 600px; class:"ntdata"}
 .dataTables_wrapper:after {
    content: ".";
    display: block;
    clear: both;
    visibility: hidden;
    line-height: 0;
    height: 0;
 td.sorting_1 {}
 .alignLeft  {text-align:left}
 .dataTables_length {width:100%}
 .dataTables_filter {text-align:left}
 table.coeffs { clear: both;}
</style>



{% if info.error is defined %}

<h1>There was an error in meeting your previous request. Please change parameters.</h1>

<div> 
<h2> Error message: </h2>

{{ info.error | safe }}
</div>
{% endif %}

<h1> A {{KNOWL('mf.maass.mwf',title='Maass waveform')}} on  \(\Gamma_{0}({{ MF.level }} )\) with {{KNOWL('mf.maass.mwf.spectralparameter',title='spectral parameter')}} R= {{MF.R}}</h1>

{% if MF is defined %}
{% set table = MF.table %}
{% set nrows = table.nrows %}
{% set ncols = table.ncols %}
{% set data = table.data %}

<h2>Fourier Coefficients</h2>
{% if MF.coeffs is defined and MF.num_coeff > 0%}
{# <table class="ntdata" id="coeffs" valign="top" border="1"> #}
<table>
<tr><td>
<table class="ntdata" id="coeffs">
  <colgroup>
    <col/>
    {% for k in range(1,ncols)  %}
     <col/>
    {%endfor%}
  </colgroup>
  <thead>
    <tr>
     {% if ncols <= 2 %}
       {% if table.negc is defined and table.negc == 0 %}
        <th> n </th><th>c(n) </th>
       {% else %}
        <th> n </th><th>c(n) </th><th>c(-n) </th>
       {%endif%}
     {% else %}
        <th> n </th>
          {% for k in range(1,ncols)  %}
            {% if table.negc is defined and table.negc == 0 %}
                <th colspan="1">\( c_{ {{k}} } (n) \) </td>
             {% else %}
                <th>\( c_{ {{k}} } (n) \) </td>
                <th>\(c_{ {{k}} } (-n) \) </td>
             {%endif%}
         {%endfor%}
     {%endif%}
    </tr>
  </thead>
  <tbody>
    {% set nnrows = 200 %}
    {%if nrows < nnrows %}
     {% set nnrows = nrows %}
    {%endif%}
    {% for r in range(0,nnrows) %}
    <tr>
      {% if table.negc is defined and table.negc == 0 %}
            <td style="border-right: 1px solid black">
            {% if data[r] is defined and data[r][0] is defined %}
              {% set n = data[r][0] %}
                {{n}}
            {% endif %}
            </td>  
            {% for k in range(1,ncols)  %}
              {% if data[r] is defined and data[r][k] is defined %}
                 {% if data[r][k] is defined %}
                    {% set c  = data[r][k] %}                 
                    {% if c is defined %}
                      <td>{{c | safe}}</td>
                    {% else %}
                      <td></td>
                    {% endif %}
                 {% endif %}
             {% endif %}
          {% endfor %}

     {%else%}
            <td style="border-right: 1px solid black">
            {% if data[r] is defined and data[r][0] is defined %}
              {% set n = data[r][0] %}
                {{n}}
              {% endif %}
            </td>  
            {% for k in range(1,ncols)  %}
              {% set cp="" %}
              {% set cn="" %}
               {% if data[r] is defined and data[r][k] is defined %}
                  {% if data[r][k] is defined %}
                    {% set cp,cn  = data[r][k] %}
                  {% endif %}
               {% endif %}
              <td>{{cp}}</td><td>{{cn}}</td>
           {% endfor %}
      {%endif%}
    </tr>
    {% endfor %}
   </tbody>
</table>
</td></tr>
<tr><td>
<p>
{# <form name="search" method = "get" action="{{url_for('mwf.render_one_maass_waveform',maass_id=maassid)}}">
  <input type="hidden" name="id" value="{{maassid}}">
  <input type="hidden" name="download" value="coefficients">
  <button type="submit" name="Submit" value="Get more">Download coefficients</button>	
</form> #}
</td></tr></table>
<div style="clear:both">
{# { KNOWL('metadata.knowl-tag') } #}
</div>
{% else %}
There are no Fourier coefficients supplied for this Maass form.
{% endif %}

{% else %}
There is no Maass waveform supplied.

{% endif %}


{% endblock content %}
